package gestionColis;

/**
 * Interface definition : GestAdherent
 * 
 * @author OpenORB Compiler
 */
public class _GestAdherentStub extends org.omg.CORBA.portable.ObjectImpl
        implements GestAdherent
{
    static final String[] _ids_list =
    {
        "IDL:gestionColis/GestAdherent:1.0"
    };

    public String[] _ids()
    {
     return _ids_list;
    }

    private final static Class _opsClass = gestionColis.GestAdherentOperations.class;

    /**
     * Operation inscrireAdherent
     */
    public void inscrireAdherent(gestionColis.InfoAdherent adherent, gestionColis.Adherent adherentIOR)
        throws gestionColis.InfoAdherentInvalideException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("inscrireAdherent",true);
                    gestionColis.InfoAdherentHelper.write(_output,adherent);
                    gestionColis.AdherentHelper.write(_output,adherentIOR);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionColis.InfoAdherentInvalideExceptionHelper.id()))
                    {
                        throw gestionColis.InfoAdherentInvalideExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("inscrireAdherent",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestAdherentOperations _self = (gestionColis.GestAdherentOperations) _so.servant;
                try
                {
                    _self.inscrireAdherent( adherent,  adherentIOR);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation notifierArriveeColis
     */
    public void notifierArriveeColis(gestionColis.InfoColis colis)
        throws gestionColis.AdherentInconnuException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("notifierArriveeColis",true);
                    gestionColis.InfoColisHelper.write(_output,colis);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionColis.AdherentInconnuExceptionHelper.id()))
                    {
                        throw gestionColis.AdherentInconnuExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("notifierArriveeColis",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestAdherentOperations _self = (gestionColis.GestAdherentOperations) _so.servant;
                try
                {
                    _self.notifierArriveeColis( colis);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation adherentExiste
     */
    public String adherentExiste(gestionColis.InfoAdherent destinataire)
        throws gestionColis.AdherentInconnuException
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("adherentExiste",true);
                    gestionColis.InfoAdherentHelper.write(_output,destinataire);
                    _input = this._invoke(_output);
                    String _arg_ret = _input.read_string();
                    return _arg_ret;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    if (_exception_id.equals(gestionColis.AdherentInconnuExceptionHelper.id()))
                    {
                        throw gestionColis.AdherentInconnuExceptionHelper.read(_exception.getInputStream());
                    }

                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("adherentExiste",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestAdherentOperations _self = (gestionColis.GestAdherentOperations) _so.servant;
                try
                {
                    return _self.adherentExiste( destinataire);
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation enregistrerAdherent
     */
    public void enregistrerAdherent(gestionColis.Adherent adherent)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("enregistrerAdherent",true);
                    gestionColis.AdherentHelper.write(_output,adherent);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("enregistrerAdherent",_opsClass);
                if (_so == null)
                   continue;
                gestionColis.GestAdherentOperations _self = (gestionColis.GestAdherentOperations) _so.servant;
                try
                {
                    _self.enregistrerAdherent( adherent);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

}
